package com.frostmourne.loreoriginex.commands;

import com.frostmourne.loreoriginex.LoreOriginEX;
import com.frostmourne.loreoriginex.objects.EntityData;
import com.frostmourne.loreoriginex.objects.LoreOriginData;
import com.frostmourne.loreoriginex.objects.managers.PlayerDataManager;
import com.frostmourne.loreoriginex.utils.LangUtils;
import com.gitee.mxstars.commands.BaseCommand;
import com.gitee.mxstars.commands.annotation.Command;
import com.gitee.mxstars.commands.layout.CommandArgs;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;

public class CommandHandler extends BaseCommand {
    @Override
    public JavaPlugin getPlugin() {
        return LoreOriginEX.getInstance();
    }

    @Override
    @Command(name = "loex",aliases = "ilo")
    public void onCommand(CommandArgs commandArgs) {

        if (commandArgs.getArgs().length == 0){
            commandArgs.getPlayer().sendMessage( "§c[系统] §e§l你的属性");
            commandArgs.getPlayer().sendMessage(ChatColor.DARK_GRAY + "-----------------------");
            if (!PlayerDataManager.getDataMap().containsKey(commandArgs.getPlayer().getUniqueId())){
                commandArgs.getPlayer().sendMessage( "§7无");
            }else{
                EntityData entityData = PlayerDataManager.getDataMap().get(commandArgs.getPlayer().getUniqueId());
                for (LoreOriginData data : entityData.getLoreOriginData()){
                    LangUtils.sendStats(commandArgs.getPlayer(), data);
                }
            }
            commandArgs.getPlayer().sendMessage(ChatColor.DARK_GRAY + "-----------------------");

        }

    }
}
